package com.test.card.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.test.card.enums.ApiResponseEnum;
import lombok.Data;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@Data
public class ApiReponse<T> {
    private Integer code;
    private String msg;
    private T data;

    public ApiReponse() {
    }

    public ApiReponse(ApiResponseEnum apiResponseEnum,T data){
        this.code = apiResponseEnum.getCode();
        this.msg = apiResponseEnum.getMessage();
        this.data = data;
    }

    public ApiReponse(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
}
